package com.cskaoyan.service;

import com.cskaoyan.bean.MarketUser;
import com.cskaoyan.bean.vo.UserVo;
import com.cskaoyan.mapper.MarketUserMapper;
import com.cskaoyan.util.MyBatisUtil;
import org.apache.ibatis.session.SqlSessionFactory;

/**
 * @author stone
 * @date 2023/03/18 00:58
 */
public class UserServiceImpl implements UserService {
    SqlSessionFactory sqlSessionFactory = MyBatisUtil.getSqlSessionFactory();
    @Override
    public UserVo findUserVoById(Integer userId) {
        MarketUserMapper userMapper = sqlSessionFactory.openSession().getMapper(MarketUserMapper.class);

        MarketUser user = userMapper.selectByPrimaryKey(userId);
        UserVo userVo = new UserVo();
        userVo.setNickname(user.getNickname());
        userVo.setAvatar(user.getAvatar());
        return userVo;
    }
}
